﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace client
{
    public class Statek
    {
        int dlugosc;
        int health;
        List<XYButton> pola;

        public Statek(int dlugosc, List<XYButton> lista)
        {
            this.dlugosc = dlugosc;
            health = dlugosc;
            pola = lista;
            foreach (XYButton pole in lista)
            {
                pole.zajmij(this);
            }
        }

        public bool czyZywy()
        {
            if (health == 0)
                return false;
            return true;
        }

        public void utrata()
        {
            health--;
            if(health == 0)
                foreach (XYButton but in pola)
                {
                    but.zatop();
                }
        }
    }
}
